
package labb6;

import java.util.Stack;


public class history{
    Stack<String> past, future;
    Boolean pastEmpty, futureEmpty;

    history(){
        past = new Stack<>();
        future = new Stack<>();
    }
    
    void addPast(String url){
    past.push(url);
    }
    
    void addFuture(String url){
    future.push(url);
    }
    
    String back(){
        return past.pop();
    }
    
    String forward(){
        return future.pop();
    }
    
    Boolean isPastEmpty(){
        Boolean isEmpty = false;
        if (past.peek()==null || past.empty()){
            isEmpty = true;
        }
        return isEmpty;
    }
    Boolean isFutureEmpty(){
        return future.empty();
    }
    
    void clearFuture(){
        while(!future.empty()){
            future.pop();
        }
    }
}